Skip to content

Refactor: Move all precompiles into crates/{pallet}/precompiles/ folder#307

Merged
bkontur merged 4 commits into
devfrom
precompiles_refactoring
Jul 23, 2026
Merged

Refactor: Move all precompiles into crates/{pallet}/precompiles/ folder#307
bkontur merged 4 commits into
devfrom
precompiles_refactoring

Conversation

@danielbui12

Copy link
Copy Markdown
Member
  • Move the three pallet_revive precompile crates under crates/precompiles/, dropping the redundant -precompile directory suffix (package names unchanged)
  • Update workspace members and path dependencies in the root Cargo.toml

- Move the three pallet_revive precompile crates under crates/precompiles/, dropping the redundant -precompile directory suffix (package names unchanged)
- Update workspace members and path dependencies in the root Cargo.toml
- Update license-header globs and path references in CONTRIBUTING.md, CLAUDE.md, docs/design/smart-contracts.md, and examples/contracts/README.md
@danielbui12 danielbui12 self-assigned this Jul 22, 2026
@danielbui12
danielbui12 marked this pull request as ready for review July 22, 2026 12:21
@danielbui12
danielbui12 requested review from bkontur and ilchu July 22, 2026 12:22

@bkontur bkontur left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielbui12 I am checking, how we did precompiles in Polkadot SDK, and I would like to keep the same pattern here and align those:

  • Keep precompiles next to their pallet — in polkadot-sdk each precompile crate sits in a precompiles/ folder right beside the pallet it wraps (frame/assets/precompiles, frame/vesting/precompiles, xcm/pallet-xcm/precompiles), rather than all bundled in one central spot. If these belong to a specific pallet, popping them next to it keeps us consistent. (If they're genuinely standalone, a shared crates/precompiles/ is totally fine — just flagging the upstream habit.)
  • .sol location — upstream keeps the interface either at the crate root or in src/interface/ (like pallet-xcm/precompiles/src/interface/IXcm.sol). We're putting it straight in src/, so maybe move it to src/interface/I*.sol to match?

wdyt?

Everything else already matches nicely (package names, the lib.rs/mock.rs/tests.rs layout, etc).

@danielbui12

Copy link
Copy Markdown
Member Author

@bkontur I'm okay with it, let's follow polkadot-sdk pattern

- Relocate the three precompile crates from crates/precompiles/* to crates/pallets/*/precompiles/
- Move Solidity interface files into a src/interface/ subfolder and update the alloy::sol! paths
- Update workspace members and dependency paths in the root Cargo.toml
- Update directory references in CLAUDE.md, CONTRIBUTING.md, docs/design/smart-contracts.md, and examples/contracts/README.md
- Adjust licenserc.apache.toml include patterns for the new layout
@danielbui12
danielbui12 requested a review from eskimor as a code owner July 23, 2026 02:27
@danielbui12 danielbui12 changed the title Refactor: Move all precompiles into crates/precompiles/ folder Refactor: Move all precompiles into crates/{pallet}/precompiles/ folder Jul 23, 2026
use tracing::error;

alloy::sol!("src/IDriveRegistry.sol");
alloy::sol!("src/interface/IDriveRegistry.sol");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is also possibility to write the interface directly to the rs file alloy::sol! {, not sure which one is better

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that I tried several approaches, and Cisco's Photo App PRs also mentioned this issue before. It seems to be due to revive's poor support for this

@bkontur
bkontur enabled auto-merge July 23, 2026 09:11
@bkontur

bkontur commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

/cmd fmt

@danielbui12

Copy link
Copy Markdown
Member Author

@bkontur It is due to an unexpected job cancellation. It happens several times, just re-run job, then it works

@bkontur
bkontur added this pull request to the merge queue Jul 23, 2026
@bkontur
bkontur removed this pull request from the merge queue due to a manual request Jul 23, 2026
@bkontur
bkontur merged commit 76a2c2d into dev Jul 23, 2026
55 of 59 checks passed
@bkontur
bkontur deleted the precompiles_refactoring branch July 23, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants